function _get(value: number | string | undefined, list: any[]) {
  if (value !== undefined) {
    const tmp = list.find((x: any) => {
      return x.value === value
    })
    if (tmp) return tmp.label
    return ''
  } else {
    return list
  }
}

export function DemandSources(value: string | undefined = undefined) {
  const list = [
    {
      label: '咨询项目',
      value: '咨询项目'
    },
    {
      label: '产业大脑项目',
      value: '产业大脑项目'
    },
    {
      label: '产业大脑SAAS',
      value: '产业大脑SAAS'
    },
    {
      label: '金融数据服务项目',
      value: '金融数据服务项目'
    },
    {
      label: '公司领导',
      value: '公司领导'
    },
    {
      label: '运营需求',
      value: '运营需求'
    },
    {
      label: '自主规划',
      value: '自主规划'
    },
    {
      label: '其他',
      value: '其他'
    }
  ]
  return _get(value, list)
}

// 事件对应的表
export function getEventTableType(value: string | undefined = undefined) {
  const list = [
    {
      label: 'dw_poif_news',
      value: '产业外溢'
    },
    {
      label: 'dw_lget_list_device',
      value: '器械获批上市'
    },
    {
      label: 'dw_lget_building_materials_eva',
      value: '绿色建材评价'
    },
    {
      label: 'dw_lget_product_cert',
      value: '农机产品认证'
    },
    {
      label: 'dw_lget_green_car_product',
      value: '新能源汽车发布'
    },
    {
      label: 'dw_lget_health_food_record',
      value: '保健食品备案'
    },
    {
      label: 'dw_lget_domestic_drug',
      value: '药品获批上市'
    },
    {
      label: 'dw_lget_new_vet_drug',
      value: '新兽药注册'
    },
    {
      label: 'dw_lget_device_acce',
      value: '器械受理'
    },
    {
      label: 'dw_lget_cde_drug_acce',
      value: '新药管线'
    },
    {
      label: 'dw_lget_cn_drug_clinicaltrial',
      value: '药品临床试验'
    },
    {
      label: 'dw_lget_drug_priority_eva',
      value: '药品优先审评'
    },
    {
      label: 'dw_lget_gqce_approve',
      value: '仿制药一致性评价'
    },
    {
      label: 'dw_lget_inno_device_prio',
      value: '器械特殊审批'
    },
    {
      label: 'dw_psif_tech_award',
      value: '重大奖项'
    },
    {
      label: 'dw_poif_news',
      value: '人事动向'
    },
    {
      label: 'dw_lget_security_code',
      value: '企业成功上市'
    },
    {
      label: 'dw_lget_ipo_appl',
      value: '企业申请上市'
    },
    {
      label: 'dw_lget_merge_event',
      value: '并购企业'
    },
    {
      label: 'dw_lget_merge_event',
      value: '企业被并购'
    },
    {
      label: 'dw_lget_company_inv',
      value: '对外投资'
    },
    {
      label: 'dw_lget_company_qualification',
      value: '资质证书'
    },
    {
      label: 'dw_lget_finance_event',
      value: '获得融资'
    },
    {
      label: 'dw_poif_news',
      value: '安全事件'
    },
    {
      label: 'dw_lget_company_change',
      value: '工商变更'
    },
    {
      label: 'dw_lget_company_executed',
      value: '被执行人'
    },
    {
      label: 'dw_lget_company_judgment',
      value: '裁判文书'
    },
    {
      label: 'dw_lget_company_adm_punish',
      value: '行政处罚'
    },
    {
      label: 'dw_lget_company_trial_notice',
      value: '开庭公告'
    },
    {
      label: 'dw_lget_company_lose_trust',
      value: '失信被执行人'
    },
    {
      label: 'dw_lget_company_judicial_case',
      value: '立案信息'
    },
    {
      label: 'dw_lget_company_court_notice',
      value: '法院公告'
    },
    {
      label: 'dw_lget_brand_info',
      value: '商标注册'
    },
    {
      label: 'dw_lget_patent_info',
      value: '发明专利'
    },
    {
      label: 'dw_lget_patent_info',
      value: '发明授权'
    },
    {
      label: 'dw_lget_patent_info',
      value: '发明专利授权'
    },
    {
      label: 'dw_lget_patent_info',
      value: '实用新型'
    },
    {
      label: 'dw_poif_news',
      value: '经营状况'
    },
    {
      label: 'dw_lget_company_anomaly_list',
      value: '经营异常'
    },
    {
      label: 'dw_lget_company_pledge_equity',
      value: '股权出质'
    },
    {
      label: 'dw_poif_news',
      value: '经营风险'
    }
  ]
  return _get(value, list)
}

// 有效和无效
export function getValidType(value: number | undefined = undefined) {
  const list = [
    {
      label: '无效',
      value: 0
    },
    {
      label: '有效',
      value: 1
    }
  ]
  return _get(value, list)
}
